import Vue from 'vue'
import Vuex from 'vuex'
// @/ -> src目录
import { getItem } from '@/utils/storage'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // 用户基本信息
    userInfo: getItem("userInfo"),
    // 用户角色信息 角色控制权限
    userRole: getItem("userRole"),
  },
  mutations: {
    userInfoMutation(state, payload) {
      // 更改 userInfo 值
      state.userInfo = payload;
    },
    userRoleMutation(state, payload) {
      state.userRole = payload;
    }
  },
  actions: {
  },
  modules: {
  }
})
